import os, re


def r(p):
    f = open(p)
    s = f.read()
    f.close()
    return s


def w(p, s):
    f = open(p, 'w')
    f.write(s)
    f.close()


ss = '''<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.3.RELEASE</version>
    </parent>'''

for root, dirs, files in os.walk('f:/spring-boot-samples'):
    for f in files:
        p = os.path.join(root, f)
        if f.endswith('.java'):
            s = r(p)
            s1 = re.sub(r'^\s*/\*[\w\W]+?\*/\s+', '', s)
            if s1 != s:
                print p
                w(p, s1)
        elif f == 'pom.xml':
            s = r(p)
            s1 = re.sub(r'<parent>[\w\W]+?</parent>', ss, s)
            if s1 != s:
                print p
                w(p, s1)
